package com.kinth.common;

import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;

  
@SuppressWarnings("deprecation")
public class HttpClientConnectionManager {  
      
      
    /** 
     * @param httpClient 
     * @return 
     */  
//    public static HttpClient getSSLInstance(HttpClient httpClient){  
//        ClientConnectionManager ccm = httpClient.getConnectionManager();  
//        SchemeRegistry sr = ccm.getSchemeRegistry();  
//        sr.register(new Scheme("https", MySSLSocketFactory.getInstance(), 443));  
//        httpClient =  new DefaultHttpClient(ccm, httpClient.getParams());  
//        return httpClient;  
//    }  
      
    /** 
     *  
     * @param url 
     * @return 
     */  
    public static HttpPost getPostMethod(String url) {  
        HttpPost pmethod = new HttpPost(url); // ������Ӧͷ��Ϣ  
        pmethod.addHeader("Connection", "keep-alive");  
//        pmethod.addHeader("Accept", "*/*");  
//        pmethod.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");  
//        pmethod.addHeader("Host", "mp.weixin.qq.com");  
        pmethod.addHeader("X-Requested-With", "XMLHttpRequest");  
        pmethod.addHeader("Cache-Control", "max-age=0");  
        
        pmethod.addHeader("Content-type","application/json; charset=utf-8");  
        pmethod.addHeader("Accept", "application/json");  
        
        pmethod.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");  
        return pmethod;  
    }  
  
    /**  
     * @param url  
     * @return  
     */  
    public static HttpGet getGetMethod(String url) {  
        HttpGet pmethod = new HttpGet(url);  
        pmethod.addHeader("Connection", "keep-alive");  
        pmethod.addHeader("Cache-Control", "max-age=0");  
        pmethod.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");  
        pmethod.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/;q=0.8");  
        return pmethod;  
    }  
}